list=[3,0,2,3,1,5,7,4,6,8]
def method1(list):
    privot=list[0]
    i=0
    j=len(list)-1
    while i<j:
        while i<j and list[j]>privot:
            j=j-1
        while i<j and list[i]<=privot:
            i=i+1
        if(i<j):
            tmp=list[j]
            list[j]=list[i]
            list[i]=tmp
    print("i==",i,",j==",j)
    tmp=list[j]
    list[j]=list[0]
    list[0]=tmp
    print(list)

def method2(list):
    privot=list[0]
    i=0
    j=len(list)-1
    while i<j:
        while i<j and list[j]>privot:
            j=j-1
        if i<j:
            list[i]=list[j]
        while i<j and list[i]<=privot:
            i=i+1
        if i<j:
            list[j]=list[i]
    list[i]=privot
    print(list)

method1(list.copy())
method2(list.copy())